import request from "@/utils/request"  //组件内部封装的axios
import { requestPath } from '../utils/global'

// 获取手机号验证码
export function getPhoneCodeAPI(params) {
	return  request({
        url: `${requestPath.component}/captcha/phone`,
        method: 'get',
        params
    })
}

// 快速登录
export function fastLoginAPI(data) {
	return  request({
        url: `${requestPath.componentFg}/login/phone`,
        method: 'post',
        data
    })
}

// 账号手机号登录
export function userLoginAPI(data){
  return request({
      url:`${requestPath.componentFg}/login/login`,
      method:'post',
      data
  })
}

// 首次登录设置密码
export function firstLoginAPI(data){
    return request({
        url:`${requestPath.componentFg}/login/phone/reset-password`,
        method:'post',
        data
    })
}

/* 机构 */
// 机构注册
export function memberRegisterAPI(data){
    return request({
        url:`${requestPath.componentFg}/login/register`,
        method:'post',
        data
    })
}

// 异步验证机构是否存在
export function asyncValidateCodeAPI(params) {
	return  request({
        url:`${requestPath.componentFg}/login/validate/code`,
        method: 'get',
        params
    })
}

// 异步验证用户名是否存在
export function asyncValidateAccountAPI(params) {
	return  request({
        url:`${requestPath.componentFg}/login/validate/account`,
        method: 'get',
        params
    })
}

/* 重置密码 */
// 用户重置密码 手机短信验证
export function validateResetPassAPI(data){
    return request({
        url:`${requestPath.componentFg}/login/validate/reset-pass`,
        method:'post',
        data
    })
}

// 重置密码
export function resetPasswordAPI(data){
    return request({
        url:`${requestPath.componentFg}/login/reset-pass`,
        method:'post',
        data
    })
}

/* 绑定用户 */
export function bindingUserAPI(data){
    return request({
        url:`${requestPath.componentFg}/login/third/reset-phone`,
        method:'post',
        data
    })
}

// 微信登录
export function wechatLoginAPI(params) {
    return request({
      url: `${requestPath.componentFg}/login/wechat`,
      method: 'get',
      params
    })
  }